package com.code2roc.jarmanage.db;

import com.code2roc.jarmanage.model.DepolyUploadVersionDO;
import com.code2roc.jarmanage.util.DataBaseUtil;

import java.util.List;

public class DepolyUploadVersionDB {
    public static void insert(DepolyUploadVersionDO entity) {
        DataBaseUtil.insert("DepolyUploadVersion", entity);
    }

    public static void update(DepolyUploadVersionDO entity) {
        DataBaseUtil.update("DepolyUploadVersion", entity, "versionID");
    }

    public static void delete(String versionID) {
        DataBaseUtil.executeSQL("delete from DepolyUploadVersion where versionID='" + versionID + "'");
    }

    public static DepolyUploadVersionDO selectOne(String versionID) {
        return DataBaseUtil.selectOne(DepolyUploadVersionDO.class, "DepolyUploadVersion", "versionID", versionID);
    }

    public static List<DepolyUploadVersionDO> selectList(String projectID) {
        return DataBaseUtil.selectList(DepolyUploadVersionDO.class, "DepolyUploadVersion", "projectID='" + projectID + "'","versionName desc");
    }

    public static List<DepolyUploadVersionDO> selectRollList(String projectID) {
        return DataBaseUtil.selectList(DepolyUploadVersionDO.class, "DepolyUploadVersion", "projectID='" + projectID + "' and forceKeep='0'","versionName desc");
    }
}
